export default function showSize(size) {
    if (!size) return '0B';
    let sizeLevel = 0
    let sizeSuffix = 'B'
    while (size >= 1024) {
        size /= 1024;
        sizeLevel++
    }
    switch (sizeLevel) {
        case 0:
            sizeSuffix = 'B'
            break
        case 1:
            sizeSuffix = 'KB'
            break
        case 2:
            sizeSuffix = 'MB'
            break
        case 3:
            sizeSuffix = 'GB'
            break
        case 4:
            sizeSuffix = 'TB'
            break
        case 5:
            sizeSuffix = 'PB'
            break
    }
    return `${size.toFixed(2)}${sizeSuffix}`
}